﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SceneFrame
{
    /// <summary>
    /// 触发器
    /// </summary>
    public class Trigger
    {
        public Trigger() { }

        public Trigger(string name)
        {
            Name = name;
        }

        public Trigger(string name, Dictionary<string, string> dic)
            : this(name)
        {
            Data = dic;
        }

        /// <summary>
        /// 触发器的名称
        /// </summary>
        public virtual string Name { get; protected set; } = "Trigger";

        /// <summary>
        /// 内部的数据字典
        /// </summary>
        protected virtual Dictionary<string, string> Data { get; set; }

        /// <summary>
        /// 全部的Key
        /// </summary>
        public virtual IEnumerable<string> AllKeys { get { return Data.Keys; } }

        /// <summary>
        /// 根据Key获取对应的数据
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public virtual string GetData(string key)
        {
            return Data.ContainsKey(key) ? Data[key] : null;
        }
    }
}
